# PN532-HSU ESP-IDF Component

It is a simple driver for esp-idf with `PN532` support which works through HSU.

## Features

It has nothing except initialization and passive `ID` reads.
Anyways:

  * It is an UART device which takes only 2 pins
  * Passive mode for ids reading.

## Configuration

It is simple, you should specify uart port and pins using `menuconfig`.

## Usage

The device must be initialized using

```
int pn532_init()
```

Then it could be possible to read values like this:

```
  while (1) {
    if ((len = pn532_read(buf, 64)) != ESP_FAIL) {
      len = pn532_decode_card(buf, len, card);
      printf("Card Detected: ");
      printbuf(card, len);
      puts("");
      vTaskDelay(500 / portTICK_PERIOD_MS);
    }

    vTaskDelay(100 / portTICK_PERIOD_MS);
  }
```

The `pn532_decode_card()` is an improvisation which is intended to cut id values
using packet provided length. There's no magic.

See [main.c](/main/main.c) for a complete example.

## License

GPLv2
